gtkscale: fix bogus compare func
authorStefan Sauer <ensonic@users.sf.net>
Mon, 9 Jan 2012 17:16:53 +0000 (18:16 +0100)
committerStefan Sauer <ensonic@users.sf.net>
Mon, 9 Jan 2012 17:33:11 +0000 (18:33 +0100)
The GtkScaleMark values are gdouble, a simple a-b compare func would fail for
values with the same integer value. This breaks the sorting and causes random
marker label placement.

gtk/gtkscale.c

index 006a8ddd15d75ae6478ae2ba82528c6953b5dcb8..e4a7df926e27b2141be9daefdd86d6041bdb6936 100644 (file)
@@ -1529,7 +1529,7 @@ compare_marks (gpointer a, gpointer b)
 
   ma = a; mb = b;
 
-  return (gint) (ma->value - mb->value);
+  return (ma->value > mb->value) ? 1 : ((ma->value == mb->value) ? 0 : -1);
 }
 
 /**